<%--
  Created by IntelliJ IDEA.
  User: LENOVO
  Date: 2020/5/28
  Time: 9:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    request.setCharacterEncoding("utf-8");
    String user = request.getParameter("newUsername");
    String pswd = request.getParameter("newPassword1");
    String s = request.getParameter("newPassword2");
    if(user.equals("") || pswd.equals("")){
        out.println("用户名或密码不能为空，3秒后返回注册页面！");
        response.setHeader("refresh","3;URL=register.jsp");
    }
    else if(pswd.length()<6 || pswd.length()>18){
        out.println("密码长度至少为6位，最多为18位，3秒后返回注册页面！");
        response.setHeader("refresh","3;URL=register.jsp");
    }
    else if(user.length()<4 || user.length()>16){
        out.println("用户名至少为4位，最多为16位，3秒后返回注册页面！");
        response.setHeader("refresh","3;URL=register.jsp");
    }
    else{
        session.setAttribute("user",user);
        session.setAttribute("pswd",pswd);
        response.sendRedirect("successRegister.jsp");
    }
%>
